

<!--
 * @Description: 屏片专用检测项目
 * 
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved. 
-->
<template>
  <div class="content">
    <!-- 1.聚焦滤线栅与有用线束中心对准------------------------------------------------------------------------ -->
    <div id="table1">
      <div class="innertitle">
        1.聚焦滤线栅与有用线束中心对准：
        <span style="font-weight: normal; font-size: 14px;">
          （<el-checkbox style="margin-right: 0px;" v-model="form1.notHaveMobileDevice">不满足标准检测方法要求</el-checkbox>）
          （<el-checkbox
            v-model="form1.notHaveState"
            @change="(value) => {
              if (value === false) {
                form1.notHaveMobileDevice = ''
                form1.convergenceDistance = ''
                form1.tubeCurrentUnit = ''
                form1.tubeVoltage = ''
                form1.tubeCurrent = ''
                form1.second = ''
                form1.frontOne = ''
                form1.frontTwo = ''
                form1.center = ''
                form1.afterTwo = ''
                form1.afterOne = ''
                form1.deviate = ''
              }
            }"
          >状态检测无此项</el-checkbox>）
        </span>
      </div>
      <div>
        会聚滤线栅的会聚距离：<el-input v-model="form1.convergenceDistance" class="input-line"/>cm，调节SID与会聚滤线栅的会聚距离一致
      </div>
      <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 100%;">
        <tr>
          <td colspan="3">照射条件设置值</td>
          <td colspan="5">胶片圆孔区域影像的光密度(OD)</td>
          <td rowspan="2">偏离(mm)</td>
        </tr>
        <tr>
          <td>kV</td>
          <td>
            <el-radio v-model="form1.tubeCurrentUnit" :label="0">mA</el-radio>
            <el-radio v-model="form1.tubeCurrentUnit" :label="1">mAs</el-radio>
          </td>
          <td>s</td>
          <td>前1</td>
          <td>前2</td>
          <td>中心孔</td>
          <td>后2</td>
          <td>后1</td>
        </tr>
        <tr>
          <td><el-input v-model="form1.tubeVoltage" class="input-line"/></td>
          <td><el-input v-model="form1.tubeCurrent" class="input-line"/></td>
          <td><el-input v-model="form1.second" class="input-line"/></td>
          <td><el-input v-model="form1.frontOne" class="input-line"/></td>
          <td><el-input v-model="form1.frontTwo" class="input-line"/></td>
          <td><el-input v-model="form1.center" class="input-line"/></td>
          <td><el-input v-model="form1.afterTwo" class="input-line"/></td>
          <td><el-input v-model="form1.afterOne" class="input-line"/></td>
          <td><el-input v-model="form1.deviate" class="input-line"/></td>
        </tr>
      </table>
    </div>


    <!-- 1.聚焦滤线栅与有用线束中心对准------------------------------------------------------------------------ -->
    <!-- <div id="table1">
      <div class="innertitle">
        1.聚焦滤线栅与有用线束中心对准 
        (<el-checkbox v-model="form1.notHaveMobileDevice" @change="submitTestForm(1)">移动设备不检测此项</el-checkbox>)
        <el-radio-group v-model="form1.type">
          <el-radio :label="1">改机没有滤线栅</el-radio>
          <el-radio :label="2">改机是振动式滤线栅</el-radio>
          <el-radio :label="3">改机是非聚焦式滤线栅</el-radio>
        </el-radio-group>
      </div>
      <div class="tip-30">
        <el-checkbox v-model="form1.notHaveState">状态检测无此项</el-checkbox>
        <el-checkbox v-model="form1.cannotMoved">改机管球不能前后移动</el-checkbox>
        <el-checkbox v-model="form1.notEquipped">不具备国际要求的检测条件</el-checkbox>
        <br/>
        聚焦滤线栅的会聚距离： <el-input v-model="form1.convergenceDistance" style="width: 40px;"></el-input>cm,调节SID与聚焦滤线栅的会聚距离一致
      </div>

      <table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 100%;">
        <tr>
          <td colspan="3">照射条件设置值</td>
          <td colspan="5">胶片圆孔区域影像的光密度（OD）</td>
          <td rowspan="2">偏离（mm）</td>
        </tr>

        <tr>
          <td>kV</td>
          <td>
            <el-select
								v-model="form1.tubeCurrentUnit"
								size="mini"
								placeholder="请选择参数"
                class="splitselect"
								:style="{'width': '100px'}"
								clearable
              >
								<el-option label="mA" :value="0"></el-option>
								<el-option label="mAs" :value="1"></el-option>
							</el-select>
          </td>
          <td>s</td>
          <td>前1</td>
          <td>前2</td>
          <td>中心孔</td>
          <td>后2</td>
          <td>后1</td>
        </tr>

        <tr>
          <td>
            <el-input v-model="form1.tubeVoltage"/>
          </td>
          <td>
            <el-input v-model="form1.tubeCurrent"/>
          </td>
          <td>
            <el-input v-model="form1.second"/>
          </td>
          <td>
            <el-input v-model="form1.frontOne"/>
          </td>
          <td>
            <el-input v-model="form1.frontTwo"/>
          </td>
          <td>
            <el-input v-model="form1.center"/>
          </td>
          <td>
            <el-input v-model="form1.afterOne"/>
          </td>
          <td>
            <el-input v-model="form1.afterTwo"/>
          </td>
          <td>
            <el-input v-model="form1.deviate"/>
          </td>
        </tr>
      </table>
    </div> -->
  </div>
</template>

<script>
import {getInfoById05, centerAlignment} from '@/api/testItem/item05'

export default {
  name: "testItem05",
  data() {
    return {
      fovList: [
        {
          id: 1,
          label: 'mm',
          value: '1'
        },
      ],
      readoutList: [
        {
          id: 1,
          label: 'uGy/s',
          value: '1'
        },
        {
          id: 2,
          label: 'uGy/min',
          value: '2'
        },
        {
          id: 3,
          label: 'mGy/min',
          value: '3'
        },
      ],
      fieldSizeList: [
        {
          id: 1,
          label: 'mm',
          value: '1'
        },
      ],
      // tab切换通用数据
			form: {},
			// 表单-1.透视受检者入射体表空气比释动能率典型值
			form1: {

			},
			itemsId: null,
    };
  },
  props: {
		// tab栏
    activeNameEquipment: {
			type: String,
      default: "0",
    },
		// 基本信息数据
    basicForm: {
			type: Object,
      default: () => {
				return {}
			},
    },
		// // 打开录入的行
    // opendialogRow: {
		// 	type: Object,
    //   default: () => {
		// 		return {}
		// 	},
    // },
  },
  // computed: {
  //   basicInfo() {
	// 			return JSON.parse(this.basicForm.basicInfo) || {};
  //   },
  // },
  watch: {
    activeNameEquipment: {
      handler(val) {
        let _this = this;
				this.$nextTick(()=>{
						// 获取详情
          getInfoById05(this.basicForm.resultId).then(response => {
            this.itemsId =  response.data?.itemsId;
            // 1.探测器剂量指示（DDI）
            this.form1 =  response.data?.centerAlignment || {};
          }).catch((response) => {
            console.log("catch-->getInfoById05", response);
            this.$emit("loadingchange", true);
          });
          // 绑定请求
          let itemsLength = 1;
          for (let index = 0; index < itemsLength; index++) {
            
            let tableInputs = Array.from(document.getElementById(`table${index + 1}`).getElementsByTagName("input"))
            for (let i = 0; i < tableInputs.length; i++) {
							this.bind(tableInputs[i], () => {
								this.submitTestForm(index + 1)
							})
              // let elSelect = this.elHaveComponent(tableInputs[i]) // 获取Component
              // elSelect.$on('change', function(){
              //   this.validate(tableInputs[i])
              //   _this.submitTestForm(index + 1)
              // })
              
            }
            
          }
				})
      },
      deep: true,
      immediate: true
    },
  },
  methods: {
    
    /**
     * isPostion  table{XX}/table2-{XX}
     */
     handleChangeReadoutValueUnit(value, isPostion) {
      console.log(value, isPostion)
      this.submitTestForm(isPostion)
    },
		// DSA设备专用项目-03
		submitTestForm(index) {
			console.log("提交检测项", index);
			this.$emit("loadingchange", true); /* 说明绑定成功 */
			this[`form${index}`].itemsId = this.itemsId;
			switch (index) {
				// 1.DAS动态范围。DAS对比灵敏度 伪影
				case 1:
          centerAlignment(this.form1).then((response) => {
						// this.$modal.msgSuccess("保存成功");
						response.data ? this.form1 = response.data : "";
						this.$emit("loadingchange", false);
					})
        	break;
			}
		},
		// 更改电压
		changetube(val, index) {
			console.log("更改电压", val);
			if (val == "other") {
				if (index == "5") {
					this.$set(this.form5, "tubeVoltage", "");
				}
				if (index == "7") {
					this.$set(this.form7, "tubeVoltage", "");
				}
				if (index == "81") {
					this.$set(this.form8, "tubeVoltage_1", "");
				}
				if (index == "82") {
					this.$set(this.form8, "tubeVoltage_2", "");
				}
				if (index == "2-8") {
					this.$set(this.form8, "sid", "");
				}
			}
			if (index == "2-1") {
				this.$set(this.form, "cus_formsid", "");
				if(val == "0") {
					this.$set(this.form, "sid", "180");
				}
				if(val == "1") {
					this.$set(this.form, "sid", this.form.cus_formsid);
				}
			}
		},
    handleChangeInfo() {
      console.log('11111111', this.activeNameEquipment)
      this.submitTestForm(1)
    },
  },
};
</script>

<style lang="scss" scoped>
@import '../content.scss';
</style>